layui.use(['form','layer'],function(){
    var form = layui.form
    layer = parent.layer === undefined ? layui.layer : top.layer,
        $ = layui.jquery;
    var upload = layui.upload;
    var treeSelect = layui.treeSelect;
    var laydate = layui.laydate;

    //回显数据
    var request = GetRequest();
    $.get("/datarecord/" + request.id,function (data) {
        $.get("/equipment/" + data.equipmentId,function (data) {
            $("#name").val(data.name);
        });
        $("#channelNo").val(data.channelNo);
        $.get("/checkitem/" + data.checkItemId,function (data) {
            $("#checkItem").val(data.name);
            $("#unit").val(data.unit);
        });
        $("#processedData").val(data.processedData);
        var date = new Date(data.acquisitionTime);
        $("#acquisitionTime").val(date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()+ " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds());
        date = new Date(data.reportingTime);
        $("#reportingTime").val(date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()+ " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds());
    });


    //获取路径中的参数
    function GetRequest() {
        var url = location.search;         //获取url中"?"符后的字串
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            var strs = str.split("&");
            for (var i = 0; i < strs.length; i++) {
                theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
            }
        }
        return theRequest;
    }


});